//入：(2 -> 4 -> 3) + (5 -> 6 -> 4)
//输出：7 -> 0 -> 8
//原因：342 + 465 = 807
let a = '443'
let b = '564'//809
function add(p1,p2){
    let arr1 = Array.from(p1).reverse()
    let arr2 = Array.from(p2).reverse()
     console.log(arr1,arr2)
    // return
    let len1 = arr1.length;
    let len2 = arr2.length;
    if(len1>len2){
        for(let i =0;i<len1-len2;i++){
            arr2.push(0)
        }
    }
    if(len1<len2){
        for(let i =0;i<len2-len1;i++){
            arr1.push(0)
        }
    }
  let sum=  arr1.map((item,index)=>{
    //   console.log(item)
    let sum=0;
        arr2.map((item2,index2)=>{
            if(index==index2){ 
                sum =  Number(item)+ Number(item2)  
            }   
        })
        console.log(sum,'////')
        return sum

    })
     sum.map((item,index)=>{
        if(item>9){
            console.log(sum[0],item,'大于10')
            
                sum[index]=item%10;

                if(index!=0){
                    sum[index-1]+=1
                }else{
                    console.log(sum[0],'111111111')
                }
                
        }
    })
    console.log(arr1,arr2,sum)
}
add(a,b)

